package com.iris.live.services.report.data.formulars;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description:公式工厂
 * @author: Tony.Zhang
 * @Date: 2017-08-23 18:07
 **/
public class FormularFactory {
    private static Map<String, IFormular> formulars = new HashMap<>();

    static {
        formulars.put("groovy", new GroovyFormular());
    }

    public static IFormular getFormular(String formularName) throws Exception{
        if(formulars.containsKey(formularName)){
            return formulars.get(formularName);
        }else{
            throw new Exception("No formular found for name=" + formularName);
        }
    }
}
